#ifndef QZEROICON_H
#define QZEROICON_H

#include <QMouseEvent>
#include "qzerorectangle.h"
#include "qzerotexture.h"

class QZeroIconProperties
{
public:

  QZeroIconProperties()
    : filename_(), action_(), sticky_(false) {}

  QZeroIconProperties(const std::string& filename, const std::string& action, bool sticky)
  {
    filename_ = filename;
    action_ = action;
    sticky_ = sticky;
  }

  QZeroIconProperties(const QZeroIconProperties& prop)
  {
    filename_ = prop.filename();
    action_ = prop.action();
    sticky_ = prop.sticky();
  }

  ~QZeroIconProperties() {};

  std::string filename() const { return(filename_); }
  std::string action() const { return(action_); }
  bool sticky() const { return(sticky_); }


private:

  std::string filename_;
  std::string action_;
  bool sticky_;

};

class QZeroIcon
{

public:

  QZeroIcon(const QZeroIconProperties& prop);

  QZeroIcon(const QZeroIcon& icon);

  ~QZeroIcon();

  void draw(unsigned int width, unsigned int height, int z);

  bool highlight(int x, int y);

  bool Init(int x,
            int y,
            int w,
            int h);

  QZeroRectangle boundingBox() const { return(bbox); }

  QZeroTexture texture() const { return(theTex); }

  void press(int x, int y);

  void release(int x, int y);

  bool highlighted() const { return(highlighted_); }

  bool down() const { return(down_); }

  void setAlpha(float alpha)
  {
    alpha_ = alpha;
  }

  QZeroIconProperties prop() const { return(prop_); }

private:
  int _x,_y;
  int _w;
  int _h;
  QZeroRectangle bbox;
  QZeroTexture theTex;
  bool highlighted_, down_;
  QZeroIconProperties prop_;

  bool mouseOverBox(int x, int y);
  float alpha_;
};

#endif
